package com.example.Controller;

import com.example.entity.Friends;
import com.example.service.FriendsService;
import com.example.utils.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * The type Friends controller.
 * @author XingGao
 */
@CrossOrigin //跨域
@RestController
@RequestMapping(value = "/friends")
public class FriendsController {
    @Autowired
    private FriendsService friendsService;

    /**
     * Add fiends result data.
     *
     * @param friends the friends
     * @return the result data
     */
    @PostMapping("/addFiends")
    public ResultData addFiends(@RequestBody Friends friends) {
        return friendsService.addFriends(friends);
    }

    /**
     * Gets friends.
     *
     * @return the friends
     */
    @PostMapping("/getFiends")
    public ResultData getFriends() {
        return friendsService.getFriends();
    }

    /**
     * Del friends result data.
     *
     * @param friends the friends
     * @return the result data
     */
    @PostMapping("/delFiends")
    public ResultData delFriends(@RequestBody Friends friends) {
        return friendsService.delFriends(friends);
    }

    /**
     * Up friends result data.
     *
     * @param friends the friends
     * @return the result data
     */
    @PostMapping("/UpFiends")
    public ResultData UpFriends(@RequestBody Friends friends) {
        return friendsService.UpFriends(friends);
    }
}
